﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Lib;

namespace OnDutyApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Random random = new Random((int)DateTime.Now.Ticks);
            Thread.Sleep(random.Next(1000 * 60 * 5));
            int retryCount = 0;
            while (retryCount < 3)
            {
                try
                {
                    Helper.WriterLog("On duty result:" + Helper.OnDuty());
                }
                catch (Exception ex)
                {
                    retryCount++;
                    Helper.WriterLog("Exception:" + ex.Message + "\r\n" + ex.StackTrace);
                    if (retryCount < 3)
                    {
                        Helper.WriterLog("Retry " + (retryCount + 1));
                        Thread.Sleep(10000);
                    }
                }
            }
        }
    }
}
